<?php

namespace App\Http\Requests\User;

use App\Http\Requests\Request;

class UserCreateRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'user_name' => 'email|unique:user,user_name',          
            'password'=>'min:6|confirmed',
            'password_confirmation' => 'required',
        ];
    }

    public function messages()
    {
        return [
            //'user_name.required'=>'请填写用户名',
            'user_name.unique'=>'该用户名已被注册', 
            'user_name.email'=>'请填写邮箱格式',
            //'password.required'=>'请填写密码', 
            'password_confirmation.required'=>'请确认密码',
            'password.min'=>'密码长度至少6位',
            //'password.max'=>'密码长度不超过20位', 
            'password.confirmed'=>'密码确认不匹配',
        ];
    }
}
